function fn() {
  fn2();
  console.log(3);
}

async function fn2() {
  console.log(1);
  await Promise.resolve().then(() => {
    console.log(2);
  });
  console.log(4);
  
}


fn()

// 防抖函数